﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:props="clr-namespace:ScrumFactory.Windows.Properties"                    
                    xmlns:sys="clr-namespace:System;assembly=mscorlib">


    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Padding" Value="0"/>
        
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource TabControlBorderBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>        
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="TabItem">
                    <Setter Property="Foreground" Value="{StaticResource TabItemBrush}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate  TargetType="{x:Type TabItem}">                                    
                                    <Border x:Name="shadowBorder" 
                                            Margin="5,0,0,0"
                                            CornerRadius="5,5,0,0"
                                            BorderThickness="1,0,1,0">
                                        <Border.BorderBrush>
                                            <SolidColorBrush Color="Gray" Opacity="0.3"/>
                                        </Border.BorderBrush>
                                        <Border
                                        x:Name="tabBorder"
                                        Margin="0,0,0,-1"                  
                                            
                                        BorderBrush="Gray" BorderThickness="1,1,1,0"                                     
                                        CornerRadius="5,5,0,0">
                                            <Border.Background>
                                                <SolidColorBrush Color="{StaticResource Blue0Color}"/>
                                            </Border.Background>
                                            <ContentPresenter x:Name="content" ContentSource="Header" Margin="5,0,5,3" Cursor="Hand">                                            
                                            <ContentPresenter.Style>
                                                <Style>
                                                    <Style.Triggers>
                                                        <Trigger Property="ContentPresenter.IsMouseOver" Value="True">
                                                            <Setter Property="ContentPresenter.Effect">
                                                                <Setter.Value>
                                                                    <DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="{StaticResource Green3Color}" />
                                                                </Setter.Value>
                                                            </Setter>
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </ContentPresenter.Style>
                                        </ContentPresenter>
                                        </Border>
                                    </Border>

                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsSelected" Value="False">
                                        <Setter TargetName="shadowBorder" Property="Border.BorderBrush" Value="Transparent"/>
                                        <Setter TargetName="tabBorder" Property="Border.Background" Value="Transparent"/>
                                        <Setter TargetName="tabBorder" Property="Border.BorderBrush" Value="Transparent"/>
                                        
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="content" Property="ContentPresenter.Effect" Value="{x:Null}"/>
                                    </Trigger>

                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{StaticResource TabSelectedItemBrush}"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DockPanelTabControl"  TargetType="{x:Type TabControl}">
        <Setter Property="Background" Value="{StaticResource DockPanelLeftBackground}"/>        
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="TabItem">                         
                    <Setter Property="Content">
                        <Setter.Value>
                            <ContentPresenter Content="{Binding View}"/>                                                      
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Header" Value="{Binding PanelName}"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type TabItem}">
                                <ControlTemplate.Resources>
                                    <Style TargetType="{x:Type ToggleButton}">                                        
                                        <Setter Property="IsTabStop" Value="False"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border x:Name="border" Padding="5,3,5,5" Margin="0,5,0,0"  CornerRadius="6,6,0,0" Cursor="Hand">
                                                        <ContentPresenter x:Name="contentPresenter">
                                                            <ContentPresenter.Resources>
                                                                <Style TargetType="TextBlock">
                                                                    <Setter Property="FontSize" Value="{StaticResource MuchBiggerFontSize}"/>
                                                                </Style>
                                                            </ContentPresenter.Resources>
                                                        </ContentPresenter>
                                                        <Border.Style>
                                                            <Style>
                                                                <Setter Property="Border.BorderBrush" Value="Transparent"/>
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=DataContext.PanelPlacement}" Value="DockPanelLeft">
                                                                        <Setter Property="Border.LayoutTransform">
                                                                            <Setter.Value>
                                                                                <RotateTransform Angle="90" />
                                                                            </Setter.Value>
                                                                        </Setter>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </Border.Style>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsChecked" Value="True">
                                                            <Setter TargetName="contentPresenter" Property="TextBlock.Foreground"  Value="{StaticResource DockPanelSelectedTabItemForeground}"/>
                                                        </Trigger>
                                                        <Trigger Property="IsChecked" Value="False">
                                                            <Setter TargetName="contentPresenter" Property="TextBlock.Foreground"  Value="{StaticResource DockPanelTabItemForeground}"/>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter TargetName="border" Property="Background">
                                                                <Setter.Value>
                                                                    <SolidColorBrush Color="Black" Opacity="0.1"/>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ControlTemplate.Resources>
                                <ToggleButton                                                             
                                    IsChecked="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=IsSelected}"
                                    Content="{TemplateBinding Header}"/>                                     
                                
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="HasItems" Value="False">
                <Setter Property="Visibility" Value="Collapsed"/>
            </Trigger>                 
        </Style.Triggers>
    </Style>


</ResourceDictionary>